home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Source / CommentedPSCode / RCS / Lines,v < prev    next >
Encoding:
Text File  |  1995-06-12  |  3.9 KB  |  226 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.3;
  5. locks    death:1.4;
  6. comment  @# @;
  7.  
  8.  
  9. 1.4
  10. date     93.04.04.23.30.44;  author death;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     93.01.09.21.07.30;  author death;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     93.01.01.11.51.37;  author death;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     92.12.31.15.34.17;  author death;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Sun Apr  4 23:30:44 PDT 1993
  38. @
  39. text
  40. @%BEGIN Lines
  41.  
  42. %%%%%%%%%%%%%
  43. %    Define the current pict point used for drawing lines
  44. %%%%%%%%%%%%%
  45. /currentX 0 def
  46. /currentY 0 def
  47.  
  48. %%%%%%%%%%%%%
  49. %    Name:    PICTline
  50. %    Syntax:    x1 y1 x2 y2 PICTline -
  51. %    About:    Draws a line from first to second point, using current pattern,
  52. %            width&height. This is drawn in the Mac way, with the pen down
  53. %            and right of coordinate.  pen size of 1 is stroked so it looks
  54. %            better (but not placed as accurately)
  55. %%%%%%%%%%%%%
  56. /PICTline
  57. {
  58.     /endY exch def
  59.     /endX exch def
  60.     /startY exch def
  61.     /startX exch def
  62.  
  63.     %
  64.     %    Only draw if pensize > 0
  65.     %
  66.     penHeight 0 gt
  67.     penWidth 0 gt
  68.     and
  69.     {
  70.         gsave
  71.             penPattern usePattern
  72.             newpath
  73.                 %
  74.                 %    If pensize is 1, do simple display.
  75.                 %
  76.                 penHeight 1 eq
  77.                 penWidth 1 eq
  78.                 and
  79.                 {
  80.                     startX startY moveto
  81.                     endX endY lineto
  82.                     stroke
  83.                 }
  84.                 {
  85.                     %
  86.                     %    Draw the line as a multi-sided shape. compute corner
  87.                     %    coords based on which direction it is drawn in.
  88.                     %
  89.                     endY startY lt
  90.                     {
  91.                         endX startX gt
  92.                         {
  93.                             startX startY moveto
  94.                             endX endY lineto
  95.                             endX penWidth add  endY lineto
  96.                             endX penWidth add  endY penHeight add lineto
  97.                             startX penWidth add  startY penHeight add lineto
  98.                             startX  startY penHeight add lineto
  99.                         }
  100.                         {
  101.                             startX penWidth add startY moveto
  102.                             endX penWidth add endY lineto
  103.                             endX endY lineto
  104.                             endX endY penHeight add lineto
  105.                             startX startY penHeight add lineto
  106.                             startX penWidth add startY penHeight add lineto
  107.                         }
  108.                         ifelse
  109.                     }
  110.                     {
  111.                         endX startX gt
  112.                         {
  113.                             startX startY moveto
  114.                             startX penWidth add startY lineto
  115.                             endX penWidth add endY lineto
  116.                             endX penWidth add endY penHeight add lineto
  117.                             endX endY penHeight add lineto
  118.                             startX startY penHeight add lineto
  119.                         }
  120.                         {
  121.                             startX startY moveto
  122.                             endX endY lineto
  123.                             endX endY penHeight add lineto
  124.                             endX penWidth add endY penHeight add lineto
  125.                             startX penWidth add  startY penHeight add lineto
  126.                             startX penWidth add  startY lineto
  127.                         }
  128.                         ifelse
  129.                     }
  130.                     ifelse
  131.                 closepath
  132.                 fill
  133.             }    % End pensize = 1.
  134.             ifelse
  135.         grestore
  136.     }    % End pensize >0
  137.     if
  138. } def
  139.  
  140.  
  141.  
  142. %%%%%%%%%%%%%
  143. %    Name:    line                [0020]
  144. %    Syntax:    x1 y1 x2 y2 line -
  145. %    About:    Given a pair of x,y coordinates, draw a pict-style line from
  146. %            the first to the last, and store the current point.
  147. %%%%%%%%%%%%%
  148. /line
  149. {
  150.     /endY exch def
  151.     /endX exch def
  152.     /startY exch def
  153.     /startX exch def
  154.  
  155.     startX startY endX endY PICTline    
  156.     
  157.     /currentX endX def
  158.     /currentY endY def
  159. } def
  160.  
  161. %%%%%%%%%%%%%
  162. %    Name:    LineFrom            [0021]
  163. %    Syntax:    x2 y2 line -
  164. %    About:    Draws a line from the current pon to the x and y coord passed.
  165. %%%%%%%%%%%%%
  166. /lineFrom
  167. {
  168.     /endY exch def
  169.     /endX exch def
  170.     currentX currentY endX endY line
  171. } def
  172.  
  173. %%%%%%%%%%%%%
  174. %    Name:    line                [0022]
  175. %    Syntax:    x1 y1 dx dy line -
  176. %    About:    Draws a line from pt 1 to pt 1' (1' = 1 + dx,dy)
  177. %%%%%%%%%%%%%
  178. /shortLine
  179. {
  180.     /dy exch def
  181.     /dx exch def
  182.     /startY exch def
  183.     /startX exch def
  184.     startX  startY startX dx add startY dy add line
  185. } def
  186.  
  187. %%%%%%%%%%%%%
  188. %    Name:    ShortLineFrom        [0023]
  189. %    Syntax:    dx dy ShortLineFrom -
  190. %    About:    Draws a line the current to the pased offset from it
  191. %%%%%%%%%%%%%
  192. /shortLineFrom
  193. {
  194.     /dy exch def
  195.     /dx exch def
  196.     currentX currentY currentX dx add currentY dy add line
  197. } def
  198.  
  199. %END Lines
  200. @
  201.  
  202.  
  203. 1.3
  204. log
  205. @Sat Jan  9 21:07:30 PST 1993
  206. @
  207. text
  208. @@
  209.  
  210.  
  211. 1.2
  212. log
  213. @Fri Jan  1 11:51:36 PST 1993
  214. @
  215. text
  216. @d10 94
  217. @
  218.  
  219.  
  220. 1.1
  221. log
  222. @Thu Dec 31 15:34:17 PST 1992
  223. @
  224. text
  225. @@
  226.